package com.wuxiaofan.ware.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.wuxiaofan.ware.entity.WareSku;
import com.wuxiaofan.ware.entity.custom.WareSkuCustom;
import com.wuxiaofan.ware.mapper.WareSkuMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.wuxiaofan.ware.client.Idgenerator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;

@Service
public class WareSkuService {
    @Autowired
    private WareSkuMapper wmsWareSkuMapper;
    @Resource
    private Idgenerator idgenerator;
    public WareSku findById(String id){
        return wmsWareSkuMapper.selectById(id);
    }

    public WareSkuCustom findCountByMap(Map paraMap){
        return wmsWareSkuMapper.findCountByMap(paraMap);
    }

    public WareSkuCustom findGroupByMap(Map paraMap){
        return wmsWareSkuMapper.findGroupByMap(paraMap);
    }

    public List<WareSkuCustom> findByMap(Map paraMap){
        return wmsWareSkuMapper.findByMap(paraMap);
    }

    public Page<WareSkuCustom> findByMap(Map paraMap, Page page){
        return page.setRecords(wmsWareSkuMapper.findByMap(paraMap,page));
    }


    public void updateMapById(Map paraMap){
        wmsWareSkuMapper.updateMapById(paraMap);
    }
    public void delById(String id){
        wmsWareSkuMapper.deleteById(id);
    }

    public WareSku save(WareSku wmsWareSku){
        wmsWareSku.setId(idgenerator.getId());
        wmsWareSkuMapper.insert(wmsWareSku);
        return wmsWareSku;
    }

}
